一、图的遍历</h2>
<h3 id="11-深度优先搜索dfs">§1.1 深度优先搜索（DFS）</h3>
<p>找连通块、判断是否有环（如 207 题）等。部分题目<strong>做法不止一种</strong>。</p>
<p>模板（计算每个连通块的大小）：</p>

<ul>
<li><a href="https://leetcode.cn/problems/number-of-provinces/" target="_blank">547. 省份数量</a></li>
<li><a href="https://leetcode.cn/problems/find-if-path-exists-in-graph/" target="_blank">1971. 寻找图中是否存在路径</a></li>
<li><a href="https://leetcode.cn/problems/all-paths-from-source-to-target/" target="_blank">797. 所有可能的路径</a> 1383</li>
<li><a href="https://leetcode.cn/problems/jump-game-iii/" target="_blank">1306. 跳跃游戏 III</a> 1397</li>
<li><a href="https://leetcode.cn/problems/keys-and-rooms/" target="_blank">841. 钥匙和房间</a> 1412</li>
<li><a href="https://leetcode.cn/problems/count-unreachable-pairs-of-nodes-in-an-undirected-graph/" target="_blank">2316. 统计无向图中无法互相到达点对数</a> 1604</li>
<li><a href="https://leetcode.cn/problems/number-of-operations-to-make-network-connected/" target="_blank">1319. 连通网络的操作次数</a> 1633</li>
<li><a href="https://leetcode.cn/problems/minimum-score-of-a-path-between-two-cities/" target="_blank">2492. 两个城市间路径的最小分数</a> 1680</li>
<li><a href="https://leetcode.cn/problems/remove-methods-from-project/" target="_blank">3310. 移除可疑的方法</a> 1711</li>
<li><a href="https://leetcode.cn/problems/count-the-number-of-complete-components/" target="_blank">2685. 统计完全连通分量的数量</a> 1769</li>
<li><a href="https://leetcode.cn/problems/all-ancestors-of-a-node-in-a-directed-acyclic-graph/" target="_blank">2192. 有向无环图中一个节点的所有祖先</a> 1788</li>
<li><a href="https://leetcode.cn/problems/maximize-amount-after-two-days-of-conversions/" target="_blank">3387. 两天自由外汇交易后的最大货币数</a> 1788</li>
<li><a href="https://leetcode.cn/problems/minimize-malware-spread/" target="_blank">924. 尽量减少恶意软件的传播</a> 1869</li>
<li><a href="https://leetcode.cn/problems/detonate-the-maximum-bombs/" target="_blank">2101. 引爆最多的炸弹</a> 1880</li>
<li><a href="https://leetcode.cn/problems/accounts-merge/" target="_blank">721. 账户合并</a></li>
<li><a href="https://leetcode.cn/problems/course-schedule/" target="_blank">207. 课程表</a> 三色标记法判环</li>
<li><a href="https://leetcode.cn/problems/find-eventual-safe-states/" target="_blank">802. 找到最终的安全状态</a> 1962</li>
<li><a href="https://leetcode.cn/problems/minimize-malware-spread-ii/" target="_blank">928. 尽量减少恶意软件的传播 II</a> 1985</li>
<li><a href="https://leetcode.cn/problems/find-all-people-with-secret/" target="_blank">2092. 找出知晓秘密的所有专家</a> 2004</li>
<li><a href="https://leetcode.cn/problems/minimum-cost-walk-in-weighted-graph/" target="_blank">3108. 带权图里旅途的最小代价</a> 2109</li>
<li><a href="https://leetcode.cn/problems/chuan-di-xin-xi/" target="_blank">LCP 07. 传递信息</a></li>
<li><a href="https://leetcode.cn/problems/graph-valid-tree/" target="_blank">261. 以图判树</a>（会员题）</li>
<li><a href="https://leetcode.cn/problems/number-of-connected-components-in-an-undirected-graph/" target="_blank">323. 无向图中连通分量的数目</a>（会员题）</li>
</ul>
<p><strong>思维扩展</strong>：</p>
<ul>
<li><a href="https://leetcode.cn/problems/maximum-candies-you-can-get-from-boxes/" target="_blank">1298. 你能从盒子里获得的最大糖果数</a> 1825</li>
</ul>
<h3 id="12-广度优先搜索bfs">§1.2 广度优先搜索（BFS）</h3>
<p>求最短路等。要求边权都是 <span class="math math-inline"><span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height: 0.6444em;"></span><span class="mord">1</span></span></span></span></span>（或者说都是同一个正数）。</p>
<ul>
<li><a href="https://leetcode.cn/problems/shortest-distance-after-road-addition-queries-i/" target="_blank">3243. 新增道路查询后的最短距离 I</a> 1568</li>
<li><a href="https://leetcode.cn/problems/get-watched-videos-by-your-friends/" target="_blank">1311. 获取你好友已观看的视频</a> 1653</li>
<li><a href="https://leetcode.cn/problems/count-the-number-of-houses-at-a-certain-distance-i/" target="_blank">3015. 按距离统计房屋对数目 I</a> 1658</li>
<li><a href="https://leetcode.cn/problems/shortest-path-with-alternating-colors/" target="_blank">1129. 颜色交替的最短路径</a> 1780</li>
<li><a href="https://leetcode.cn/problems/the-time-when-the-network-becomes-idle/" target="_blank">2039. 网络空闲的时刻</a> 1865</li>
<li><a href="https://leetcode.cn/problems/shortest-cycle-in-a-graph/" target="_blank">2608. 图中的最短环</a> 1904</li>
<li><a href="https://leetcode.cn/problems/bus-routes/" target="_blank">815. 公交路线</a> 1964</li>
</ul>
<h3 id="13-图论建模--bfs-最短路">§1.3 图论建模 + BFS 最短路</h3>
<p>把状态抽象成图上的点，用 BFS 遍历这张图，计算从初始状态到目标状态的最短路长度。</p>
<p>可以锻炼状态设计能力。</p>
<ul>
<li><a href="https://leetcode.cn/problems/minimum-genetic-mutation/" target="_blank">433. 最小基因变化</a></li>
<li><a href="https://leetcode.cn/problems/minimum-number-of-flips-to-convert-binary-matrix-to-zero-matrix/" target="_blank">1284. 转化为全零矩阵的最少反转次数</a> 1811</li>
<li><a href="https://leetcode.cn/problems/sliding-puzzle/" target="_blank">773. 滑动谜题</a> 1815</li>
<li><a href="https://leetcode.cn/problems/open-the-lock/" target="_blank">752. 打开转盘锁</a> 1878</li>
<li><a href="https://leetcode.cn/problems/split-and-merge-array-transformation/" target="_blank">3690. 拆分合并数组</a> 1982</li>
<li><a href="https://leetcode.cn/problems/remove-invalid-parentheses/" target="_blank">301. 删除无效的括号</a></li>
<li><a href="https://leetcode.cn/problems/freedom-trail/" target="_blank">514. 自由之路</a></li>
<li><a href="https://leetcode.cn/problems/shortest-path-visiting-all-nodes/" target="_blank">847. 访问所有节点的最短路径</a> 2201</li>
<li><a href="https://leetcode.cn/problems/k-similar-strings/" target="_blank">854. 相似度为 K 的字符串</a> 2377</li>
<li><a href="https://leetcode.cn/problems/word-ladder/" target="_blank">127. 单词接龙</a> 双向广搜</li>
<li><a href="https://leetcode.cn/problems/zuma-game/" target="_blank">488. 祖玛游戏</a></li>
<li><a href="https://leetcode.cn/problems/minimum-knight-moves/" target="_blank">1197. 进击的骑士</a>（会员题）</li>
<li><a href="https://leetcode.cn/problems/maximum-hamming-distances/" target="_blank">3141. 最大汉明距离</a>（会员题）</li>
</ul>
<p><strong>专题：跳跃游戏</strong></p>
<ul>
<li><a href="https://leetcode.cn/problems/minimum-number-of-operations-to-make-x-and-y-equal/" target="_blank">2998. 使 X 和 Y 相等的最少操作次数</a> 1795</li>
<li><a href="https://leetcode.cn/problems/jump-game-iv/" target="_blank">1345. 跳跃游戏 IV</a> 1810</li>
<li><a href="https://leetcode.cn/problems/minimum-operations-to-convert-number/" target="_blank">2059. 转化数字的最小运算数</a> 1850</li>
<li><a href="https://leetcode.cn/problems/minimum-jumps-to-reach-home/" target="_blank">1654. 到家的最少跳跃次数</a> 2124</li>
<li><a href="https://leetcode.cn/problems/minimum-jumps-to-reach-end-via-prime-teleportation/" target="_blank">3629. 通过质数传送到达终点的最少跳跃次数</a> 2139</li>
<li><a href="https://leetcode.cn/problems/zui-xiao-tiao-yue-ci-shu/" target="_blank">LCP 09. 最小跳跃次数</a></li>
</ul>
<p>注：关于<strong>网格图</strong>的 DFS 和 BFS，请看 <a href="https://leetcode.cn/circle/discuss/YiXPXW/" target="_blank">网格图题单</a>。</p>





<h2 id="二拓扑排序">二、拓扑排序</h2>
<p><img alt="图论题单 图论算法 图论题目 LeetCode 力扣图论 灵茶山艾府" src="https://pic.leetcode.cn/1738131168-tWFNGZ-006-toposort.png"></p>
<p>把拓扑排序想象成一个黑盒，给它一堆杂乱的先修课约束，它会给你一个井井有条的课程学习安排。</p>

<h3 id="21-拓扑排序">§2.1 拓扑排序</h3>
<p>学习拓扑排序前，请先完成 <a href="https://leetcode.cn/problems/minimum-number-of-vertices-to-reach-all-nodes/" target="_blank">1557. 可以到达所有点的最少点数目</a>，有助于理解拓扑排序。</p>
<ul>
<li><a href="https://leetcode.cn/problems/course-schedule-ii/" target="_blank">210. 课程表 II</a></li>
<li><a href="https://leetcode.cn/problems/find-all-possible-recipes-from-given-supplies/" target="_blank">2115. 从给定原材料中找到所有可以做出的菜</a> 1679</li>
<li><a href="https://leetcode.cn/problems/build-a-matrix-with-conditions/" target="_blank">2392. 给定条件下构造矩阵</a> 1961</li>
<li><a href="https://leetcode.cn/problems/find-eventual-safe-states/" target="_blank">802. 找到最终的安全状态</a> 1962</li>
<li><a href="https://leetcode.cn/problems/strange-printer-ii/" target="_blank">1591. 奇怪的打印机 II</a> 2291</li>
<li><a href="https://leetcode.cn/problems/sort-items-by-groups-respecting-dependencies/" target="_blank">1203. 项目管理</a> 2419</li>
<li><a href="https://leetcode.cn/problems/collect-coins-in-a-tree/" target="_blank">2603. 收集树中金币</a> 2712</li>
<li><a href="https://leetcode.cn/problems/Jf1JuT/" target="_blank">LCR 114. 火星词典</a></li>
<li><a href="https://leetcode.cn/problems/sequence-reconstruction/" target="_blank">444. 序列重建</a>（会员题）拓扑序是否唯一</li>
<li><a href="https://leetcode.cn/problems/apply-substitutions/" target="_blank">3481. 应用替换</a>（会员题）也可以记忆化搜索</li>
<li><a href="https://leetcode.cn/problems/alien-dictionary/" target="_blank">269. 火星词典</a>（会员题）</li>
<li><a href="https://leetcode.cn/problems/all-paths-from-source-lead-to-destination/" target="_blank">1059. 从始点到终点的所有路径</a>（会员题）</li>
</ul>
<p><strong>思维扩展</strong>：</p>
<ul>
<li><a href="https://leetcode.cn/problems/minimum-height-trees/" target="_blank">310. 最小高度树</a></li>
<li><a href="https://leetcode.cn/problems/validate-binary-tree-nodes/" target="_blank">1361. 验证二叉树</a></li>
</ul>
<h3 id="22-在拓扑序上-dp">§2.2 在拓扑序上 DP</h3>
<p>一般是刷表法。</p>
<ul>
<li><a href="https://leetcode.cn/problems/loud-and-rich/" target="_blank">851. 喧闹和富有</a> 1783</li>
<li><a href="https://leetcode.cn/problems/parallel-courses-iii/" target="_blank">2050. 并行课程 III</a> 2084</li>
<li><a href="https://leetcode.cn/problems/network-recovery-pathways/" target="_blank">3620. 恢复网络路径</a></li>
<li><a href="https://leetcode.cn/problems/largest-color-value-in-a-directed-graph/" target="_blank">1857. 有向图中最大颜色值</a> 2313</li>
<li><a href="https://leetcode.cn/problems/parallel-courses/" target="_blank">1136. 并行课程</a>（会员题）</li>
</ul>
<h3 id="23-基环树">§2.3 基环树</h3>
<p><a href="https://leetcode.cn/problems/maximum-employees-to-be-invited-to-a-meeting/solution/nei-xiang-ji-huan-shu-tuo-bu-pai-xu-fen-c1i1b/" target="_blank">基环树介绍</a></p>
<ul>
<li><a href="https://leetcode.cn/problems/find-closest-node-to-given-two-nodes/" target="_blank">2359. 找到离给定两个节点最近的节点</a> 1715</li>
<li><a href="https://leetcode.cn/problems/longest-cycle-in-a-graph/" target="_blank">2360. 图中的最长环</a> 1897</li>
<li><a href="https://leetcode.cn/problems/redundant-connection/" target="_blank">684. 冗余连接</a> 做法不止一种</li>
<li><a href="https://leetcode.cn/problems/redundant-connection-ii/" target="_blank">685. 冗余连接 II</a></li>
<li><a href="https://leetcode.cn/problems/count-visited-nodes-in-a-directed-graph/" target="_blank">2876. 有向图访问计数</a> 2210</li>
<li><a href="https://leetcode.cn/problems/maximum-employees-to-be-invited-to-a-meeting/" target="_blank">2127. 参加会议的最多员工数</a> 2449</li>
<li><a href="https://leetcode.cn/problems/maximize-value-of-function-in-a-ball-passing-game" target="_blank">2836. 在传球游戏中最大化函数值</a> 2769 做法不止一种</li>
<li><a href="https://leetcode.cn/problems/Za25hA/" target="_blank">LCP 21. 追逐游戏</a></li>
<li><a href="https://leetcode.cn/problems/distance-to-a-cycle-in-undirected-graph/" target="_blank">2204. 无向图中到环的距离</a>（会员题）</li>
</ul>



<h2 id="三最短路">三、最短路</h2>
<h3 id="31-单源最短路dijkstra-算法">§3.1 单源最短路：Dijkstra 算法</h3>
<p><a href="https://leetcode.cn/problems/network-delay-time/solution/liang-chong-dijkstra-xie-fa-fu-ti-dan-py-ooe8/" target="_blank">Dijkstra 算法介绍</a></p>

<ul>
<li><a href="https://leetcode.cn/problems/network-delay-time/" target="_blank">743. 网络延迟时间</a></li>
<li><a href="https://leetcode.cn/problems/find-minimum-time-to-reach-last-room-i/" target="_blank">3341. 到达最后一个房间的最少时间 I</a> 1721 网格图</li>
<li><a href="https://leetcode.cn/problems/minimum-time-to-visit-disappearing-nodes/" target="_blank">3112. 访问消失节点的最少时间</a> 1757 理解原理</li>
<li><a href="https://leetcode.cn/problems/design-graph-with-shortest-path-calculator/" target="_blank">2642. 设计可以求最短路径的图类</a> 1811</li>
<li><a href="https://leetcode.cn/problems/minimum-time-to-reach-destination-in-directed-graph/" target="_blank">3604. 有向图中到达终点的最少时间</a> 1845</li>
<li><a href="https://leetcode.cn/problems/path-with-maximum-probability/" target="_blank">1514. 概率最大的路径</a> 1846</li>
<li><a href="https://leetcode.cn/problems/minimum-cost-path-with-edge-reversals/" target="_blank">3650. 边反转的最小路径总成本</a> 1854</li>
<li><a href="https://leetcode.cn/problems/find-minimum-time-to-reach-last-room-ii/" target="_blank">3342. 到达最后一个房间的最少时间 II</a> 1862 网格图</li>
<li><a href="https://leetcode.cn/problems/path-with-minimum-effort/" target="_blank">1631. 最小体力消耗路径</a> 1948 网格图 做法不止一种</li>
<li><a href="https://leetcode.cn/problems/number-of-restricted-paths-from-first-to-last-node/" target="_blank">1786. 从第一个节点出发到最后一个节点的受限路径数</a> 2079</li>
<li><a href="https://leetcode.cn/problems/find-edges-in-shortest-paths/" target="_blank">3123. 最短路径中的边</a> 2093</li>
<li><a href="https://leetcode.cn/problems/number-of-ways-to-arrive-at-destination/" target="_blank">1976. 到达目的地的方案数</a> 2095</li>
<li><a href="https://leetcode.cn/problems/swim-in-rising-water/" target="_blank">778. 水位上升的泳池中游泳</a> 2097 网格图 做法不止一种</li>
<li><a href="https://leetcode.cn/problems/minimum-cost-of-a-path-with-special-roads/" target="_blank">2662. 前往目标的最小代价</a> 2154</li>
<li><a href="https://leetcode.cn/problems/digit-operations-to-make-two-integers-equal/" target="_blank">3377. 使两个整数相等的数位操作</a> 2186</li>
<li><a href="https://leetcode.cn/problems/second-minimum-time-to-reach-destination/" target="_blank">2045. 到达目的地的第二短时间</a> 2202 也可以 BFS</li>
<li><a href="https://leetcode.cn/problems/minimize-the-maximum-edge-weight-of-graph/" target="_blank">3419. 图的最大边权的最小值</a> 2243 做法不止一种</li>
<li><a href="https://leetcode.cn/problems/reachable-nodes-in-subdivided-graph/" target="_blank">882. 细分图中的可到达节点</a> 2328</li>
<li><a href="https://leetcode.cn/problems/minimum-weighted-subgraph-with-the-required-paths/" target="_blank">2203. 得到要求路径的最小带权子图</a> 2364</li>
<li><a href="https://leetcode.cn/problems/minimum-time-to-visit-a-cell-in-a-grid/" target="_blank">2577. 在网格图中访问一个格子的最少时间</a> 2382 网格图</li>
<li><a href="https://leetcode.cn/problems/race-car/" target="_blank">818. 赛车</a> 2392</li>
<li><a href="https://leetcode.cn/problems/minimum-cost-to-reach-destination-in-time/" target="_blank">1928. 规定时间内到达终点的最小花费</a> 2413</li>
<li><a href="https://leetcode.cn/problems/cheapest-flights-within-k-stops/" target="_blank">787. K 站中转内最便宜的航班</a> 类似 1928 题</li>
<li><a href="https://leetcode.cn/problems/modify-graph-edge-weights/" target="_blank">2699. 修改图中的边权</a> 2874</li>
<li><a href="https://leetcode.cn/problems/minimum-path-cost-in-a-hidden-grid/" target="_blank">1810. 隐藏网格下的最小消耗路径</a>（会员题）</li>
<li><a href="https://leetcode.cn/problems/minimum-cost-to-reach-city-with-discounts/" target="_blank">2093. 前往目标城市的最小费用</a>（会员题）</li>
<li><a href="https://leetcode.cn/problems/minimum-cost-to-buy-apples/" target="_blank">2473. 购买苹果的最低成本</a>（会员题）</li>
<li><a href="https://leetcode.cn/problems/find-the-closest-marked-node/" target="_blank">2737. 找到最近的标记节点</a>（会员题）</li>
</ul>
<p><strong>分层图最短路</strong>：</p>
<ul>
<li><a href="https://leetcode.cn/problems/DFPeFJ/" target="_blank">LCP 35. 电动车游城市</a></li>
<li><a href="https://leetcode.cn/problems/partition-array-to-minimize-xor/" target="_blank">3599. 划分数组得到最小 XOR</a> 做法不止一种</li>
<li><a href="https://leetcode.cn/problems/minimum-time-to-transport-all-individuals/" target="_blank">3594. 所有人渡河所需的最短时间</a> 2604</li>
<li><a href="https://leetcode.cn/problems/find-shortest-path-with-k-hops/" target="_blank">2714. 找到 K 次跨越的最短路径</a>（会员题）</li>
</ul>
<p><strong>SPFA 与差分约束</strong>：</p>
<blockquote>
<p>力扣上的 SPFA 题很少。</p>
</blockquote>
<ul>
<li><a href="https://leetcode.cn/problems/minimum-time-to-complete-all-tasks/" target="_blank">2589. 完成所有任务的最少时间</a> 2381 做法不止一种</li>
</ul>
<h3 id="32-全源最短路floyd-算法">§3.2 全源最短路：Floyd 算法</h3>
<p>Floyd 算法本质是三维 DP。</p>
<p><a href="https://leetcode.cn/problems/find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance/solution/dai-ni-fa-ming-floyd-suan-fa-cong-ji-yi-m8s51/" target="_blank">带你发明 Floyd 算法：从记忆化搜索到递推</a></p>

<ul>
<li><a href="https://leetcode.cn/problems/design-graph-with-shortest-path-calculator/" target="_blank">2642. 设计可以求最短路径的图类</a> 1811 动态加边</li>
<li><a href="https://leetcode.cn/problems/find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance/" target="_blank">1334. 阈值距离内邻居最少的城市</a> 1855</li>
<li><a href="https://leetcode.cn/problems/minimum-cost-to-convert-string-i/" target="_blank">2976. 转换字符串的最小成本 I</a> 1882</li>
<li><a href="https://leetcode.cn/problems/number-of-possible-sets-of-closing-branches/" target="_blank">2959. 关闭分部的可行集合数目</a> 2077</li>
<li><a href="https://leetcode.cn/problems/minimum-cost-to-convert-string-ii/" target="_blank">2977. 转换字符串的最小成本 II</a> 2696</li>
</ul>
<p><strong>Bitset 优化 Floyd</strong></p>
<ul>
<li><a href="https://leetcode.cn/problems/course-schedule-iv/" target="_blank">1462. 课程表 IV</a> 1693</li>
<li><a href="https://leetcode.cn/problems/detonate-the-maximum-bombs/" target="_blank">2101. 引爆最多的炸弹</a></li>
</ul>







<h2 id="四最小生成树">四、最小生成树</h2>
<p>涉及到 Kruskal 算法和 Prim 算法。前者一般用于稀疏图，后者一般用于稠密图。</p>

<ul>
<li><a href="https://leetcode.cn/problems/min-cost-to-connect-all-points/" target="_blank">1584. 连接所有点的最小费用</a> 1858</li>
<li><a href="https://leetcode.cn/problems/maximize-spanning-tree-stability-with-upgrades/" target="_blank">3600. 升级后最大生成树稳定性</a> 2301 做法不止一种</li>
<li><a href="https://leetcode.cn/problems/find-critical-and-pseudo-critical-edges-in-minimum-spanning-tree/" target="_blank">1489. 找到最小生成树里的关键边和伪关键边</a> 2572</li>
<li><a href="https://leetcode.cn/problems/connecting-cities-with-minimum-cost/" target="_blank">1135. 最低成本连通所有城市</a>（会员题）</li>
<li><a href="https://leetcode.cn/problems/optimize-water-distribution-in-a-village/" target="_blank">1168. 水资源分配优化</a>（会员题）</li>
</ul>
<p><strong>思维扩展</strong></p>
<ul>
<li><a href="https://leetcode.cn/problems/minimum-cost-for-cutting-cake-ii/" target="_blank">3219. 切蛋糕的最小总开销 II</a></li>
</ul>






<h2 id="五欧拉路径欧拉回路">五、欧拉路径/欧拉回路</h2>
<p>涉及到 Hierholzer 算法。</p>
<ul>
<li><a href="https://leetcode.cn/problems/reconstruct-itinerary/" target="_blank">332. 重新安排行程</a></li>
<li><a href="https://leetcode.cn/problems/cracking-the-safe/" target="_blank">753. 破解保险箱</a> 2274</li>
<li><a href="https://leetcode.cn/problems/valid-arrangement-of-pairs/" target="_blank">2097. 合法重新排列数对</a> 2651</li>
</ul>






<h2 id="六强连通分量双连通分量">六、强连通分量/双连通分量</h2>
<p>涉及到 Tarjan 算法。</p>
<ul>
<li><a href="https://leetcode.cn/problems/critical-connections-in-a-network/" target="_blank">1192. 查找集群内的关键连接</a> 2085</li>
<li><a href="https://leetcode.cn/problems/minimum-number-of-days-to-disconnect-island/" target="_blank">1568. 使陆地分离的最少天数</a> 2209</li>
<li><a href="https://leetcode.cn/problems/s5kipK/" target="_blank">LCP 54. 夺回据点</a></li>
<li><a href="https://leetcode.cn/problems/minimum-runes-to-add-to-cast-spell/" target="_blank">3383. 施法所需最低符文数量</a>（会员题）</li>
</ul>
<h2 id="七二分图染色">七、二分图染色</h2>
<ul>
<li><a href="https://leetcode.cn/problems/is-graph-bipartite/" target="_blank">785. 判断二分图</a> 1625</li>
<li><a href="https://leetcode.cn/problems/possible-bipartition/" target="_blank">886. 可能的二分法</a> 1795</li>
</ul>
<p>关于二分图的最大匹配，见下面网络流的题目。其中标有「一对一」的题目也可以用带权二分图最大匹配做。</p>
<h2 id="八网络流">八、网络流</h2>
<p>由于有其他做法（比如状压 DP），难度分仅供参考。</p>
<ul>
<li><a href="https://leetcode.cn/problems/maximum-compatibility-score-sum/" target="_blank">1947. 最大兼容性评分和</a> 1704 一对一</li>
<li><a href="https://leetcode.cn/problems/minimum-time-to-break-locks-i/" target="_blank">3376. 破解锁的最少时间 I</a> 1793 一对一</li>
<li><a href="https://leetcode.cn/problems/minimum-moves-to-spread-stones-over-grid/" target="_blank">2850. 将石头分散到网格图的最少移动次数</a> 2001 一对多</li>
<li><a href="https://leetcode.cn/problems/minimum-xor-sum-of-two-arrays/" target="_blank">1879. 两个数组最小的异或值之和</a> 2145 一对一</li>
<li><a href="https://leetcode.cn/problems/maximum-students-taking-exam/" target="_blank">1349. 参加考试的最大学生数</a> 2386 二分图最大独立集</li>
<li><a href="https://leetcode.cn/problems/maximum-and-sum-of-array/" target="_blank">2172. 数组的最大与和</a> 2392 多对一</li>
<li><a href="https://leetcode.cn/problems/select-cells-in-grid-with-maximum-score/" target="_blank">3276. 选择矩阵中单元格的最大得分</a> 2403</li>
<li><a href="https://leetcode.cn/problems/minimum-cost-to-connect-two-groups-of-points/" target="_blank">1595. 连通两组点的最小成本</a> 2538 带权二分图最小边覆盖</li>
<li><a href="https://leetcode.cn/problems/maximum-value-sum-by-placing-three-rooks-ii/" target="_blank">3257. 放三个车的价值之和最大 II</a> 2553</li>
<li><a href="https://leetcode.cn/problems/broken-board-dominoes/" target="_blank">LCP 04. 覆盖</a> 二分图最大匹配·模板题</li>
<li><a href="https://leetcode.cn/problems/7rLGCR/" target="_blank">LCP 38. 守卫城堡</a> 最小割</li>
<li><a href="https://leetcode.cn/problems/maximum-number-of-accepted-invitations/" target="_blank">1820. 最多邀请的个数</a>（会员题）二分图最大匹配·模板题</li>
<li><a href="https://leetcode.cn/problems/minimum-time-to-kill-all-monsters/" target="_blank">2403. 杀死所有怪物的最短时间</a>（会员题）同 3376 题</li>
<li><a href="https://leetcode.cn/problems/minimum-time-to-break-locks-ii/" target="_blank">3385. 破解锁的最少时间 II</a>（会员题）同 3376 题</li>
<li><a href="https://leetcode.cn/problems/campus-bikes-ii/" target="_blank">1066. 校园自行车分配 II</a>（会员题）一对一，但不是完美匹配</li>
<li><a href="https://leetcode.cn/problems/minimum-operations-to-remove-adjacent-ones-in-matrix/" target="_blank">2123. 使矩阵中的 1 互不相邻的最小操作数</a>（会员题）二分图最大独立集</li>
</ul>
<p><strong>模拟费用流</strong></p>
<ul>
<li><a href="https://leetcode.cn/problems/minimum-total-distance-traveled/" target="_blank">2463. 最小移动总距离</a></li>
</ul>




<h2 id="九其他">九、其他</h2>
<ul>
<li><a href="https://leetcode.cn/problems/flower-planting-with-no-adjacent/" target="_blank">1042. 不邻接植花</a> 1712</li>
<li><a href="https://leetcode.cn/problems/minimum-degree-of-a-connected-trio-in-a-graph/" target="_blank">1761. 一个图中连通三元组的最小度数</a> 2005</li>
<li><a href="https://leetcode.cn/problems/add-edges-to-make-degrees-of-all-nodes-even/" target="_blank">2508. 添加边使所有节点度数都为偶数</a> 2060</li>
<li><a href="https://leetcode.cn/problems/remove-max-number-of-edges-to-keep-graph-fully-traversable/" target="_blank">1579. 保证图可完全遍历</a> 2132</li>
<li><a href="https://leetcode.cn/problems/maximum-path-quality-of-a-graph/" target="_blank">2065. 最大化一张图中的路径价值</a> 2178</li>
<li><a href="https://leetcode.cn/problems/checking-existence-of-edge-length-limited-paths/" target="_blank">1697. 检查边长度限制的路径是否存在</a> 2300</li>
<li><a href="https://leetcode.cn/problems/maximum-score-of-a-node-sequence/" target="_blank">2242. 节点序列的最大得分</a> 2304</li>
<li><a href="https://leetcode.cn/problems/divide-nodes-into-the-maximum-number-of-groups/" target="_blank">2493. 将节点分成尽可能多的组</a> 2415 <strong>推荐</strong></li>
<li><a href="https://leetcode.cn/problems/count-pairs-of-nodes/" target="_blank">1782. 统计点对的数目</a> 2457</li>
<li><a href="https://leetcode.cn/problems/minimum-operations-to-equalize-binary-string/" target="_blank">3666. 使二进制字符串全为 1 的最少操作次数</a> 2477 进阶 BFS / Gale-Ryser 定理</li>
<li><a href="https://leetcode.cn/problems/minimum-reverse-operations/" target="_blank">2612. 最少翻转操作数</a> 2824 进阶 BFS</li>
<li><a href="https://leetcode.cn/problems/frequencies-of-shortest-supersequences/" target="_blank">3435. 最短公共超序列的字母出现频率</a> 3028</li>
<li><a href="https://leetcode.cn/problems/count-the-repetitions/" target="_blank">466. 统计重复个数</a></li>
<li><a href="https://leetcode.cn/problems/you-le-yuan-de-you-lan-ji-hua/" target="_blank">LCP 16. 游乐园的游览计划</a></li>
<li><a href="https://leetcode.cn/problems/find-the-celebrity/" target="_blank">277. 搜寻名人</a>（会员题）</li>
<li><a href="https://leetcode.cn/problems/checking-existence-of-edge-length-limited-paths-ii/" target="_blank">1724. 检查边长度限制的路径是否存在 II</a>（会员题）</li>
<li><a href="https://leetcode.cn/problems/paths-in-maze-that-lead-to-same-room/" target="_blank">2077. 殊途同归</a>（会员题）三元环计数</li>
<li><a href="https://leetcode.cn/problems/determine-if-a-simple-graph-exists/" target="_blank">3656. 判断是否存在简单图</a>（会员题）Erdős–Gallai 定理</li>
</ul>